{erl_opts, [
    debug_info,
    warnings_as_errors,
    warn_export_vars,
    warn_shadow_vars,
    warn_obsolete_guard,
    warn_unused_import,
    warn_missing_spec,
    warn_untyped_record,
    {platform_define, "^2[1-9]|^[3-9]", 'POST_OTP_21'}
]}.

{deps, [
    {jsx, "3.1.0"},
    {jesse, "1.8.1"}
]}.

{shell, [
    {config, "config/sys.config"},
    {apps, [erlmcp]}
]}.

{profiles, [
    {prod, [
        {erl_opts, [
            no_debug_info,
            warnings_as_errors,
            {d, 'PROD'}
        ]},
        {relx, [
            {dev_mode, false},
            {include_erts, true},
            {include_src, false}
        ]}
    ]},
    {test, [
        {deps, [
            {proper, "1.4.0"},
            {meck, "0.9.2"},
            {coveralls, "2.2.0"}
        ]},
        {erl_opts, [
            debug_info,
            export_all,
            nowarn_missing_spec,
            nowarn_export_all
        ]},
        {cover_enabled, true},
        {cover_export_enabled, true},
        {coveralls_coverdata, "_build/test/cover/*.coverdata"},
        {coveralls_service_name, "github"},
        {coveralls_parallel, true}
    ]},
    {dev, [
        {deps, [
            {recon, "2.5.3"},
            {observer_cli, "1.7.4"}
        ]},
        {plugins, [
            {rebar3_format, "1.3.0"},
            {rebar3_lint, "3.0.1"}
        ]}
    ]}
]}.

{dialyzer, [
    {warnings, [
        unmatched_returns,
        error_handling,
        unknown,
        no_improper_lists,
        no_fun_app,
        no_match,
        no_opaque,
        no_fail_call,
        no_contracts,
        no_behaviours,
        no_undefined_callbacks,
        race_conditions
    ]},
    {plt_apps, top_level_deps},
    {plt_extra_apps, [kernel, stdlib, ssl, inets]},
    {plt_location, local},
    {base_plt_apps, [kernel, stdlib, erts, ssl, inets]},
    {base_plt_location, global}
]}.

{xref_checks, [
    undefined_function_calls,
    undefined_functions,
    locals_not_used,
    deprecated_function_calls,
    deprecated_functions
]}.

{xref_ignores, [
    %% Ignore dynamically called functions
    {erlmcp_transport_stdio, read_loop, 2},
    {erlmcp_transport_tcp, send, 2}
]}.

{cover_enabled, true}.
{cover_export_enabled, true}.
{cover_opts, [verbose]}.

{alias, [
    {check, [xref, dialyzer, {proper, "-c"}, cover]},
    {test, [eunit, {proper, "-c"}, cover]},
    {cleanplus, [clean, {cover, "-r"}]}
]}.

{plugins, [
    rebar3_hex,
    {rebar3_proper, "0.12.1"},
    {coveralls, "2.2.0"}
]}.

%% Formatting configuration for rebar3_format
{format, [
    {files, ["src/*.erl", "include/*.hrl", "test/*.erl"]},
    {formatter, default_formatter},
    {encoding, utf8},
    {paper, 100},
    {ribbon, 90},
    {break_indent, 4},
    {sub_indent, 2}
]}.
